function initScroll(a, b, c) {
	// 滚播
	let ROLL_SPEED = 100
	// 第一个ul
	let noticeList1 = a
	// 第二个ul
	let noticeList2 = b
	// 外层的div
	let listWrapper = c

	noticeList2.innerHTML = noticeList1.innerHTML
	listWrapper.scrollTop = 0

	let timer = setInterval(rollStart, ROLL_SPEED)
	// let that = this
	function rollStart() {
		if (Math.abs(_subStr(listWrapper.style.top)) >= noticeList1.clientHeight) {
			listWrapper.style.top = '0px'
		} else {
			let top = listWrapper.style.top
			listWrapper.style.top = _subStr(top) - 2 + 'px'
		}
	}
	// 截取px前数值
	function _subStr(str) {
		let index = str.indexOf('px')
		if (index > -1) {
			return parseFloat(str.substr(0, index + 1))
		}
	}
	listWrapper.onmouseover = function() {
		clearInterval(timer)
	}
	listWrapper.onmouseout = function() {
		timer = setInterval(rollStart, ROLL_SPEED)
	}
}

export { initScroll }
